package com.jufa_3.config;

import java.util.Random;

public class WeiXinConfig {
    // 小程序ID
    private static String appID = "wx4cc1a7f69d18675f";
    // 小程序的secret
    private static String secret = "bba0b7991a58c98d1fbdc62b51ea61bf";
    // 商户号
    private static String mch_id = "1608664409";
    // 商户支付秘钥
    private static String key = "r8mONskG3279zwTr8My6evjFQ4vqNENu";
    // 交易类型
    private static String trade_type = "JSAPI";
    // 交易类型
    private static String public_Key = "r8mONskG3279zwTr8My6evjFQ4vqNENu";
    // 回调通知地址-穿透
//    private static String notify_url = "http://gwrr83.natappfree.cc/pay/callback";
    // 回调通知地址-公网
     private static String notify_url = "http://175.178.170.139:8082/pay/callback";
    // 统一下单API接口链接
    private static String url = "https://api.mch.weixin.qq.com/pay/unifiedorder";
    // 查询订单API接口链接
    private static String query_url = "https://api.mch.weixin.qq.com/pay/orderquery";
    // 得到用户唯一标识符
    private static String open_id_url = "https://api.weixin.qq.com/sns/jscode2session";
    // 获取手机号
    private static String phone_url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber";
    // 获取token
    private static String token_url = "https://api.weixin.qq.com/cgi-bin/token";

    public static String getAppID() {
        return appID;
    }

    public static String getSecret() {
        return secret;
    }

    public static String getMch_id() {
        return mch_id;
    }

    public static String getKey() {
        return key;
    }

    public static String getTrade_type() {
        return trade_type;
    }

    public static String getPublic_Key() {
        return public_Key;
    }

    public static String getNotify_url() {
        return notify_url;
    }

    public static String getUrl() {
        return url;
    }

    public static String getQuery_url() {
        return query_url;
    }

    public static String getOpen_id_url() {
        return open_id_url;
    }

    public static String getPhone_url() {
        return phone_url;
    }

    public static String getToken_url() {
        return token_url;
    }

    public static String getRandomStringByLength(int length) {
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }
}
